<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  	<%@ include file="../main.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<base href="basePath">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	
    <style type="text/css">
    	#title
    	{
    		padding:20px;
    		font-size:40px;
    		font-weight:bold;
    		color:green;
    		text-align:center;
    	}
    	
    </style>
<title>编辑</title>
</head>
<body>
<div id="title">
	编辑
</div>

<form action="<c:url value='/UserEditServlet' />" method="post">
	<input type="hidden" name="id" value="${user.id }">
	<div class="weui-cells weui-cells_form">
	<c:choose>
	<c:when test="${edit eq 'note' }">
	  <div class="weui-cells__title">个性签名</div>
      <div class="weui-cell">
           <div class="weui-cell__bd">
               <textarea class="weui-textarea" name="note"  rows="3">${user.note }</textarea>
               <div class="weui-textarea-counter"><span>0</span>/200</div>
           </div>
      </div>
    </c:when>
    <c:when test="${edit eq 'birthday' }">
      <div class="weui-cell">
           <div class="weui-cell__hd"><label for="" class="weui-label">生日</label></div>
           <div class="weui-cell__bd">
               <input class="weui-input" name="birthday" type="date" value="${user.birthday }">
           </div>
      </div>
    </c:when>
    
     <c:when test="${edit eq 'sex' }">
     <div class="weui-cells__title">性别</div>
     <div class="weui-cells weui-cells_radio">
            <label class="weui-cell weui-check__label" for="x11">
                <div class="weui-cell__bd">
                    <p>男</p>
                </div>
                <div class="weui-cell__ft">
                    <input type="radio" class="weui-check" name="sex" id="x11" value="男" <c:if test="${user.sex eq '男' }">checked="checked"</c:if> >
                    <span class="weui-icon-checked"></span>
                </div>
            </label>
            <label class="weui-cell weui-check__label" for="x12">

                <div class="weui-cell__bd">
                    <p>女</p>
                </div>
                <div class="weui-cell__ft">
                    <input type="radio" name="sex" class="weui-check" value="女" id="x12" <c:if test="${user.sex eq '女' }">checked="checked"</c:if> >
                    <span class="weui-icon-checked"></span>
                </div>
            </label>
            
        </div>
    </c:when>
    
    <c:when test="${edit eq 'status' }">
     <div class="weui-cells__title">身份</div>
     <div class="weui-cells weui-cells_radio">
            <label class="weui-cell weui-check__label" for="x11">
                <div class="weui-cell__bd">
                    <p>管理员</p>
                </div>
                <div class="weui-cell__ft">
                    <input type="radio" class="weui-check" name="status" id="x11" value="1" <c:if test="${user.status eq 1 }">checked="checked"</c:if> >
                    <span class="weui-icon-checked"></span>
                </div>
            </label>
            <label class="weui-cell weui-check__label" for="x12">

                <div class="weui-cell__bd">
                    <p>普通用户</p>
                </div>
                <div class="weui-cell__ft">
                    <input type="radio" name="status" class="weui-check" value="2" id="x12" <c:if test="${user.status eq 2 }">checked="checked"</c:if> >
                    <span class="weui-icon-checked"></span>
                </div>
            </label>
            
        </div>
    </c:when>
    
    
    <c:when test="${edit eq 'mode' }">
     <div class="weui-cells__title">状态</div>
     <div class="weui-cells weui-cells_radio">
            <label class="weui-cell weui-check__label" for="x11">
                <div class="weui-cell__bd">
                    <p>禁言</p>
                </div>
                <div class="weui-cell__ft">
                    <input type="radio" class="weui-check" name="mode" id="x11" value="0" <c:if test="${user.mode eq 0 }">checked="checked"</c:if> >
                    <span class="weui-icon-checked"></span>
                </div>
            </label>
            <label class="weui-cell weui-check__label" for="x12">

                <div class="weui-cell__bd">
                    <p>可用</p>
                </div>
                <div class="weui-cell__ft">
                    <input type="radio" name="mode" class="weui-check" value="1" id="x12" <c:if test="${user.mode eq 1 }">checked="checked"</c:if> >
                    <span class="weui-icon-checked"></span>
                </div>
            </label>
            
        </div>
    </c:when>
    
    <c:otherwise>
	  <div class="weui-cell">
	    <div class="weui-cell__hd"><label class="weui-label">
	    	<c:if test="${edit eq 'username' }">用户名</c:if>
	    
	    	
	    	<c:if test="${edit eq 'email' }">邮箱</c:if>
	    	<c:if test="${edit eq 'phone' }">手机号码</c:if>
	    </label>
	  </div>
	    <div class="weui-cell__bd">
	      <input class="weui-input" type="text" name=""  value="">
	    </div>
	  </div>
	 
	</c:otherwise>
  </c:choose>	    
	</div>
	<br/>
		<input type="submit" class="weui-btn weui-btn_primary" value="编辑"/>
</form>
    
 		
	<script type="text/javascript">
   $(function(){
       if(${user.id != session_user.id })
    	{
    	   $('#online').addClass('weui-bar__item_on').siblings('.weui-bar__item_on').removeClass('weui-bar__item_on');
    	}
       else
    	{
    	   $('#my').addClass('weui-bar__item_on').siblings('.weui-bar__item_on').removeClass('weui-bar__item_on');
    	}
	  
       if(${edit eq 'username' })
       {
    	  $('input[type=text]').attr('name','username').val('${user.username}'); 
       }
      
      
       if(${edit eq 'email' })
   	   {
   	      $('input[type=text]').attr('name','email').val('${user.email}'); 
   	   }
       if(${edit eq 'phone' })
   	   {
   	      $('input[type=text]').attr('name','phone').val('${user.phone}'); 
   	   }
      
   });
</script>
</body>
</html>
